# For more information about using CMake with Android Studio, read the
# documentation: https://d.android.com/studio/projects/add-native-code.html

# Sets the minimum version of CMake required to build the native library.

cmake_minimum_required(VERSION 3.10.2)

# Declares and names the project.

project("mplayerstudy")

add_library( # Sets the name of the library.
        mplayerstudy
        # Sets the library as a shared library.
        SHARED
        # Provides a relative path to your source file(s).
        native-lib.cpp)
find_library( # Sets the name of the path variable.
        log-lib
        log)
message(WARNING ${CMAKE_CXX_FLAGS}/../../../../)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -L$-L/home/chenzhentao/AndroidStudioProjects/MPlayerStudy/app/libs/${ANDROID_ABI}")
message(WARNING ${CMAKE_CXX_FLAGS}/../../../../)
include_directories(include)
target_link_libraries( # Specifies the target library.
        mplayerstudy
        avcodec avfilter avformat avutil swresample swscale
        # Links the target library to the log library
        # included in the NDK.
        ${log-lib}
        )

#
## 添加库——外部引入的库
## 库名称：avcodec（不需要包含前缀lib）
## 库类型：SHARED，表示动态库，后缀为.so（如果是STATIC，则表示静态库，后缀为.a）
## IMPORTED表明是外部引入的库
#add_library( avcodec
#        SHARED
#        IMPORTED)
## 设置目标属性
## 设置avcodec目标库的IMPORTED_LOCATION属性，用于说明引入库的位置
## 还可以设置其他属性，格式：PROPERTIES key value
#set_target_properties( avcodec
#        PROPERTIES IMPORTED_LOCATION
#        ${distribution_DIR}/${ANDROID_ABI}/libavcodec.a)
#
#add_library( avfilter
#        SHARED
#        IMPORTED)
#set_target_properties( avfilter
#        PROPERTIES IMPORTED_LOCATION
#        ${distribution_DIR}/${ANDROID_ABI}/libavfilter.a)
#
#add_library( avformat
#        SHARED
#        IMPORTED)
#set_target_properties( avformat
#        PROPERTIES IMPORTED_LOCATION
#        ${distribution_DIR}/${ANDROID_ABI}/libavformat.a)
#
#add_library( avutil
#        SHARED
#        IMPORTED)
#set_target_properties( avutil
#        PROPERTIES IMPORTED_LOCATION
#        ${distribution_DIR}/${ANDROID_ABI}/libavutil.a)
#
#add_library( swresample
#        SHARED
#        IMPORTED)
#set_target_properties( swresample
#        PROPERTIES IMPORTED_LOCATION
#        ${distribution_DIR}/${ANDROID_ABI}/libswresample.a)
#
#add_library( swscale
#        SHARED
#        IMPORTED)
#set_target_properties( swscale
#        PROPERTIES IMPORTED_LOCATION
#        ${distribution_DIR}/${ANDROID_ABI}/libswscale.a)
##
### 引入头文件
##include_directories(libs/include)
#
## 告诉编译器生成native-lib库需要链接的库
## native-lib库需要依赖avcodec、avfilter等库
#target_link_libraries( mplayerstudy
#        avcodec
#        avfilter
#        avformat
#        avutil
#        swresample
#        swscale
#        -landroid
#        ${log-lib} )
